
/// 设置项模型 - Setting Item Model
/// 
/// 根据后端JSON数据结构定义，用于数据转换
/// Defined based on backend JSON data structure for data conversion
class SettingItem {
  final String? title;
  final String? subtitle;
  final String? icon;
  final String? route;
  final Function()? onTap;
  final bool? showArrow;
  final bool? showDivider;

  const SettingItem({
    this.title,
    this.subtitle,
    this.icon,
    this.route,
    this.onTap,
    this.showArrow,
    this.showDivider,
  });

  /// 从JSON创建模型 - Create model from JSON
  factory SettingItem.fromJson(Map<String, dynamic> json) {
    return SettingItem(
      title: json['title']?.toString(),
      subtitle: json['subtitle']?.toString(),
      icon: json['icon']?.toString(),
      route: json['route']?.toString(),
      showArrow: json['showArrow'],
      showDivider: json['showDivider'],
    );
  }

  /// 转换为JSON - Convert to JSON
  Map<String, dynamic> toJson() {
    return {
      'title': title,
      'subtitle': subtitle,
      'icon': icon,
      'route': route,
      'showArrow': showArrow,
      'showDivider': showDivider,
    };
  }
}